<template>
	<div>
		<Header :title="title"></Header>
		<div class="aui-bg-f detail">
		    <div class="list aui-padded-t-10 aui-padded-b-10">
		        <van-row class="aui-ftn14">
		            <van-col span="6" class="aui-text-7">
		                买家帐号:
		            </van-col>
		            <van-col span="18" class="aui-text-purple" v-text="user.username"></van-col>
		        </van-row>
		    </div>
		    <div class="list aui-padded-t-10 aui-padded-b-10">
		        <van-row class="aui-ftn14">
		            <van-col span="6" class="aui-text-7">
		                平台:
		            </van-col>
		            <van-col span="18" class="aui-text-7" v-text="user.typename">
		            </van-col>
		        </van-row>
		    </div>
		    <div class="list-img aui-padded-t-10" v-if="user.type == 1">
		        <van-row class="aui-ftn14">
		            <van-col span="6" class="aui-text-7 name">
		                信用积分:
		            </van-col>
		            <van-col span="18">
		                <img :src="_level_img" alt="">
		                <div class="cover_img" :style="{backgroundImage:'url(' + user.level_image + ')'}"  @click="fnPreview(user.level_image)"></div>
		            </van-col>
		        </van-row>
		    </div>
		    <div class="list-img aui-padded-t-10" v-if="user.type == 2" v-cloak>
		        <van-row class="aui-ftn14">
		            <van-col span="6" class="aui-text-7 name" v-if="user.type == 2">
		                京享值:
		            </van-col>
		            <van-col span="18">
		                <div class="aui-text-7 name" v-text="user.value"></div>
		                <div class="cover_img aui-margin-t-0" v-if="user.type == 2"  v-bind:style="{backgroundImage:'url(' + user.level_image + ')'}" @click="fnPreview(user.level_image)"></div>
		            </van-col>
		        </van-row>
		    </div>
		    <div class="list aui-padded-t-10 aui-padded-b-10">
		        <van-row class="aui-ftn14">
		            <van-col span="6" class="aui-text-7">
		                收货城市:
		            </van-col>
		            <van-col span="18" class="aui-text-7" v-text="select_city">
		            </van-col>
		        </van-row>
		    </div>
		    <div class="list aui-padded-t-10 aui-padded-b-10">
		        <van-row class="aui-ftn14">
		            <van-col span="6" class="aui-text-7">
		                性别:
		            </van-col>
		            <van-col span="18" class="aui-text-7" v-text="user.gender">
		            </van-col>
		        </van-row>
		    </div>
		    <div class="list aui-padded-t-10 aui-padded-b-10">
		        <van-row class="aui-ftn14">
		            <van-col span="6" class="aui-text-7">
		                消费层级:
		            </van-col>
		            <van-col span="18" class="aui-text-7" v-text="user.consume">
		            </van-col>
		        </van-row>
		    </div>
		    <div class="list aui-padded-t-10 aui-padded-b-10">
		        <van-row class="aui-ftn14">
		            <van-col span="6" class="aui-text-7">
		                人群标签:
		            </van-col>
		            <van-col span="18" class="aui-text-7" v-text="user.label">
		            </van-col>
		        </van-row>
		    </div>
		    <div class="list aui-padded-t-10 aui-padded-b-10">
		        <van-row class="aui-ftn14">
		            <van-col span="6" class="aui-text-7">
		                常购类目:
		            </van-col>
		            <van-col span="18" class="aui-text-7" v-text="user.category">
		            </van-col>
		        </van-row>
		    </div>
		</div>
	</div>
</template>

<script>
	import User from '../../../service/user.js'
	import Header from '../../components/header.vue'
	export default {
		components: {
		  Header
		},
		data () {
			return {
				user: {},
				_level_img: '',
				select_city: '惠州',
				title: '查看买号'
			}
		},
		mounted() {
			this.fnCheckDetail(this.$route.params.id)
		},
		methods: {
			fnCheckDetail: function(id) {
			  this.show_lay = true;
			  User.fnCheckUser({id: id, isToken: true}).then(res => {
			    if (res && res.status) {
			      this.user = res.data[0]
			      if (this.user.level) this._level_img = require('../../../assets/tao_level'+this.user.level+'.png');
			      this.select_city = this.user.province + this.user.city + this.user.area
			    }
			  })
			},
			// 预览图片
			fnPreview: function(path) {
			    this.utils.fnPreviewPic([path])
			}
		}
	}
</script>

<style scoped>
div.detail {
	padding: 10px 20px;
  }
  div.detail div.list {
	  height: 20px;
	  line-height: 20px;
	  border-bottom: 1px dashed #eee;
  }
  div.detail div.list:last-child {
	  border-bottom: 0;
  }
  div.detail div.list-img {
	  border-bottom: 1px dashed #eee;
	  padding-bottom: 5px;
  }
  div.detail div.list-img div.name {
	  height: 20px;
	  line-height: 20px;
  }
  div.detail div.list-img img {
	  height: 10px;
  }
  div.detail div.list-img div.cover_img {
	  width: 50px;
	  height: 50px;
	  background-position: center center;
	  background-repeat: no-repeat;
	  background-size: cover;
	  margin-top: 10px;
  }
	
</style>
